package com.example.mapper;

import com.example.pojo.Student;
import org.apache.ibatis.annotations.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
import java.util.Map;

@Mapper
public interface StudentMapper {
    //查询学生总数
    @Select("select count(*)from student s left join clazz c on s.clazz_id = c.id")
    Long count();
    //分页查询学生列表
    @Select("select s.*,c.name clazzName from student s left join clazz c on s.clazz_id = c.id limit #{start},#{pageSize}")
    List<Student> list(Integer start, Integer pageSize);
    //添加学生
    void save(Student student);
    @Delete("delete from student where id in (#{ids})")
    //批量删除
    void delete(String ids);
    //根据id查询学生
    @Select("select * from student where id = #{id}")
    Student getById(Integer id);
    //修改学生
    void update(Student student);
    //修改学生违规次数和违规分数
    @Update("update student set violation_count = violation_count+1 ,violation_score = violation_score + #{score} where id = #{id}")
    void updateViolation(Integer id, Short score);



    List<Map<String, Long>> getEmpGenderData();
}
